interface TranslateType {
  translate: string
}

/**
 * 当前pdc已使用的 trigger
 */
export type MinecraftCriteriaTrigger = 'minecraft:inventory_changed' |
  "minecraft:consume_item" |
  "minecraft:item_durability_changed" |
  "minecraft:target_hit" |
  "minecraft:effects_changed" |
  "minecraft:recipe_unlocked" |
  "minecraft:tick"

export type ProvidencraftCriteriaTrigger = 'providencraft:fill_lava'

export type CriteriaTrigger = MinecraftCriteriaTrigger | ProvidencraftCriteriaTrigger

export type FrameType = 'goal' | 'challenge' | 'task'

export interface CriteriaInventoryChangedTrigger {
  items?: []
}

export interface BasicAdvancementCriteria {
  trigger: CriteriaTrigger
  conditions: unknown
}

export interface AdvancementInventoryChangedCriteria extends BasicAdvancementCriteria {
  trigger: "minecraft:inventory_changed"
  conditions: {
    items: Array<{
      item: string
    }>
  }
}

export type CombinedAdvancementCriteria = AdvancementInventoryChangedCriteria

export interface AdvancementDisplay {
  icon: {
    item: string
  }
  title: TranslateType
  description: TranslateType
  show_toast?: boolean
  announce_to_chat?: boolean
  hidden?: boolean
  frame?: FrameType
}

export interface AdvancementRewards {
  experience?: number
  loot?: any
  recipes?: string
}

export type AdvancementRequirements = Array<Array<string>> | any

export interface Advancement {
  criteria: Record<string, CombinedAdvancementCriteria>
  display?: AdvancementDisplay
  parent?: string
  rewards?: AdvancementRewards
  requirements?: AdvancementRequirements
  sends_telemetry_event?: boolean
}